Accessing link target object, null Object parameter

I am working to reverse the links in all modules in a project. I have been able to get my code to work on a test set of modules. When I move to a restored copy of the actual project I am getting an error null Object Parameter was passed ... below is the void were the error occurs. The DXL halts on the oTarget ->lm -> oSrource line.

After some output debugging I discovered that the oTarget is null, oSource is fine.  Any ideas?

void linkFlip(Skip linkList){
  Link l
  print "Reversing Links\n"
  Object oSource, oTarget
  Module mSource, mTarget, mLink
  ModName_ mnSource, mnTarget
  string sLinkMod
  for l in linkList do {
    mSource = module(source(l))
    mTarget = module(target(l))
    mnSource = module(source(l))
    mnTarget = module(target(l))
    if (!isEdit(mSource)) mSource=edit(fullName(mnSource),false) 
    if (!isEdit(mTarget)) mTarget=edit(fullName(mnTarget),false)  
    mLink = edit(fullName(module(l)), false) 
    oTarget = object(targetAbsNo(l), mTarget)
    oSource = object(sourceAbsNo(l), mSource)
    sLinkMod = fullName(module(l))
    oTarget -> sLinkMod -> oSource
    print " " sLinkMod "|" source l "|" sourceAbsNo l"|->|" target l "|" targetAbsNo l "|REVERSED"
    if(canDelete(l)){
      delete l
      print"|DELETED\n"
    } else {
      print "|FAILED\n"
    }
    rev++
    flushDeletions
  }
}



}



 

 


Wicker - Wed Mar 12 16:23:43 EDT 2014

Re: Accessing link target object, null Object parameter
Wicker - Wed Mar 12 16:27:14 EDT 2014

ok, after reading that post I realized how bad the variable names to and so were, they have been changed to oTarget and oSource. Sadly, but not surprisingly, that did not solve the issue.

Re: Accessing link target object, null Object parameter
7XUT_Antonio_Norkus - Thu Mar 13 11:25:09 EDT 2014

the function object(int absNum, Module m) works on the current displayed objects.

If your default view for a module has a filter, then it is possible for it to return null for objects that are not displayed.

After opening a module, perform:

filtering off

showDeletedObjects on

This will ensure that all objects are displayed, so that object(int absNum, Module m) won't return nulls (unless absNum really doesn't exist in the module)

Re: Accessing link target object, null Object parameter
Wicker - Thu Mar 13 12:08:04 EDT 2014

7XUT_Antonio_Norkus - Thu Mar 13 11:25:09 EDT 2014

the function object(int absNum, Module m) works on the current displayed objects.

If your default view for a module has a filter, then it is possible for it to return null for objects that are not displayed.

After opening a module, perform:

filtering off

showDeletedObjects on

This will ensure that all objects are displayed, so that object(int absNum, Module m) won't return nulls (unless absNum really doesn't exist in the module)

Wow, that was exactly the problem. I would have never thought of filtering. Many thanks!

Re: Accessing link target object, null Object parameter
llandale - Thu Mar 13 16:44:38 EDT 2014

7XUT_Antonio_Norkus - Thu Mar 13 11:25:09 EDT 2014

the function object(int absNum, Module m) works on the current displayed objects.

If your default view for a module has a filter, then it is possible for it to return null for objects that are not displayed.

After opening a module, perform:

filtering off

showDeletedObjects on

This will ensure that all objects are displayed, so that object(int absNum, Module m) won't return nulls (unless absNum really doesn't exist in the module)

Actually:

 filtering    off
 graphics     off
 outlining    off
 showPictures on
 showTables   on
 sorting      off
 showDeletedObjects(true)
 level(0)